package com.yezao.appservice

import android.app.Application
import android.content.pm.PackageManager
import android.os.IBinder
import android.os.Process
import android.util.Log

/**
 * 实现一些类似路由的模块化功能
 * 1、首先有service层定义需要实现的功能接口
 * 2、同级别的不同module 进行impl具体实现 并进行注册
 * 3、moduleB 通过service层获取对应代理
 *
 *
 *
 * */
object ServiceFactory {


    const val ACCOUNT_SERVICE="ACCOUNT_SERVICE"
    val TAG = "ServiceFactory"
    val serviceList = HashMap<String,IBinder>()



    /**
     * 注册一个服务
     * */
    fun  registerAppService(key:String,service:IBinder){
        serviceList[key] = service
    }

    fun  getAppService(key: String):IBinder?{
        for (key in serviceList.keys) {
            Log.i(TAG,"$key  ${serviceList[key]}")
        }
        return serviceList[key] ?: return null
    }

}